package com.ppc.mapper.worker;

import com.github.pagehelper.Page;
import com.ppc.entity.Requirement;
import com.ppc.entity.Task;
import com.ppc.vo.RequireBroadVO;
import com.ppc.vo.RequirePageVO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 工人需求mapper
 *
 * @author Jeferry
 * @date 2023/12/20
 */
@Mapper
public interface WorkerRequireMapper {

  /**
   * 根据需求id查询广泛需求信息
   *
   * @param requireId 需求id
   * @return {@link RequireBroadVO}
   */
  RequireBroadVO quertBroadInformationById(Long requireId);

  /**
   * 根据需求id查询需求信息
   *
   * @param requireId 需求id
   * @return {@link Requirement}
   */
  @Select("select * from requirement where require_id=#{requireId}")
  Requirement selectById(Long requireId);

  /**
   * 插入任务
   *
   * @param task 任务
   */
  void insertIntoTask(Task task);

  /**
   * 分页查询
   *
   * @param result 查询结果
   * @return {@link Page}<{@link RequirePageVO}>
   */
  Page<RequirePageVO> pageQuery(List<Long> result);

  /**
   * 修改需求状态为已完成
   *
   * @param requireId 需求id
   */
  @Update("update requirement set require_status=3 where require_id=#{requireId}")
  void changeRequireStatusIntoEnd(Long requireId);
}
